package com.hrbxlh.virtualization.service;

import com.github.pagehelper.PageInfo;
import com.hrbxlh.virtualization.dto.ImageAllocationDTO;
import com.hrbxlh.virtualization.param.CourseQueryParam;
import com.hrbxlh.virtualization.param.ImageAllocationCancelParam;
import com.hrbxlh.virtualization.param.ImageAllocationConfirmParam;
import com.hrbxlh.virtualization.vo.ChapterImageAllocationVO;
import com.hrbxlh.virtualization.vo.CourseImageAllocationVO;

import java.util.List;

/**
 * @author cheer
 */
public interface ImageAllocationService {

    boolean isClusterAllocated(Long clusterId);

    void deleteImageAllocationByClusterId(Long clusterId);

    /**
     * 分页查询课程镜像列表
     */
    PageInfo<CourseImageAllocationVO> listImageAllocationsByPage(
            Integer pageNum, Integer pageSize, CourseQueryParam courseQueryParam);

    /**
     * 查询课程下每章节的镜像分配情况
     *
     * @param courseId 课程Id
     */
    List<ChapterImageAllocationVO> queryImageAllocation(Integer courseId);

    /**
     * 查询章节的镜像分配情况
     *
     * @param chapterId 章节Id
     */
    List<ImageAllocationDTO> queryImageAllocationByChapterId(Integer chapterId);

    /**
     * 分配镜像
     */
    void confirmImageAllocation(ImageAllocationConfirmParam imageAllocationConfirmParam);

    /**
     * 取消分配镜像
     */
    void cancelImageAllocation(ImageAllocationCancelParam imageAllocationCancelParam);

    /**
     * 发布课程配置的镜像
     */
    void release(Integer courseId);

    void confirmImageAllocation(Integer courseId, List<Integer> chapterIdList);

    void cancelImageAllocation(Integer courseId, List<Integer> chapterIdList);

    boolean canUnshare(Long imageId);
}
